/*
 * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <tencentcloud/cwp/v20180228/model/MalwareInfo.h>

using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Cwp::V20180228::Model;
using namespace rapidjson;
using namespace std;

MalwareInfo::MalwareInfo() :
    m_virusNameHasBeenSet(false),
    m_fileSizeHasBeenSet(false),
    m_mD5HasBeenSet(false),
    m_filePathHasBeenSet(false),
    m_fileCreateTimeHasBeenSet(false),
    m_fileModifierTimeHasBeenSet(false),
    m_harmDescribeHasBeenSet(false),
    m_suggestSchemeHasBeenSet(false),
    m_serversNameHasBeenSet(false),
    m_hostIpHasBeenSet(false),
    m_processNameHasBeenSet(false),
    m_processIDHasBeenSet(false),
    m_tagsHasBeenSet(false),
    m_breadthHasBeenSet(false),
    m_heatHasBeenSet(false),
    m_idHasBeenSet(false),
    m_fileNameHasBeenSet(false),
    m_createTimeHasBeenSet(false),
    m_latestScanTimeHasBeenSet(false)
{
}

CoreInternalOutcome MalwareInfo::Deserialize(const Value &value)
{
    string requestId = "";


    if (value.HasMember("VirusName") && !value["VirusName"].IsNull())
    {
        if (!value["VirusName"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.VirusName` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_virusName = string(value["VirusName"].GetString());
        m_virusNameHasBeenSet = true;
    }

    if (value.HasMember("FileSize") && !value["FileSize"].IsNull())
    {
        if (!value["FileSize"].IsInt64())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.FileSize` IsInt64=false incorrectly").SetRequestId(requestId));
        }
        m_fileSize = value["FileSize"].GetInt64();
        m_fileSizeHasBeenSet = true;
    }

    if (value.HasMember("MD5") && !value["MD5"].IsNull())
    {
        if (!value["MD5"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.MD5` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_mD5 = string(value["MD5"].GetString());
        m_mD5HasBeenSet = true;
    }

    if (value.HasMember("FilePath") && !value["FilePath"].IsNull())
    {
        if (!value["FilePath"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.FilePath` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_filePath = string(value["FilePath"].GetString());
        m_filePathHasBeenSet = true;
    }

    if (value.HasMember("FileCreateTime") && !value["FileCreateTime"].IsNull())
    {
        if (!value["FileCreateTime"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.FileCreateTime` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_fileCreateTime = string(value["FileCreateTime"].GetString());
        m_fileCreateTimeHasBeenSet = true;
    }

    if (value.HasMember("FileModifierTime") && !value["FileModifierTime"].IsNull())
    {
        if (!value["FileModifierTime"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.FileModifierTime` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_fileModifierTime = string(value["FileModifierTime"].GetString());
        m_fileModifierTimeHasBeenSet = true;
    }

    if (value.HasMember("HarmDescribe") && !value["HarmDescribe"].IsNull())
    {
        if (!value["HarmDescribe"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.HarmDescribe` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_harmDescribe = string(value["HarmDescribe"].GetString());
        m_harmDescribeHasBeenSet = true;
    }

    if (value.HasMember("SuggestScheme") && !value["SuggestScheme"].IsNull())
    {
        if (!value["SuggestScheme"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.SuggestScheme` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_suggestScheme = string(value["SuggestScheme"].GetString());
        m_suggestSchemeHasBeenSet = true;
    }

    if (value.HasMember("ServersName") && !value["ServersName"].IsNull())
    {
        if (!value["ServersName"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.ServersName` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_serversName = string(value["ServersName"].GetString());
        m_serversNameHasBeenSet = true;
    }

    if (value.HasMember("HostIp") && !value["HostIp"].IsNull())
    {
        if (!value["HostIp"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.HostIp` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_hostIp = string(value["HostIp"].GetString());
        m_hostIpHasBeenSet = true;
    }

    if (value.HasMember("ProcessName") && !value["ProcessName"].IsNull())
    {
        if (!value["ProcessName"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.ProcessName` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_processName = string(value["ProcessName"].GetString());
        m_processNameHasBeenSet = true;
    }

    if (value.HasMember("ProcessID") && !value["ProcessID"].IsNull())
    {
        if (!value["ProcessID"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.ProcessID` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_processID = string(value["ProcessID"].GetString());
        m_processIDHasBeenSet = true;
    }

    if (value.HasMember("Tags") && !value["Tags"].IsNull())
    {
        if (!value["Tags"].IsArray())
            return CoreInternalOutcome(Error("response `MalwareInfo.Tags` is not array type"));

        const Value &tmpValue = value["Tags"];
        for (Value::ConstValueIterator itr = tmpValue.Begin(); itr != tmpValue.End(); ++itr)
        {
            m_tags.push_back((*itr).GetString());
        }
        m_tagsHasBeenSet = true;
    }

    if (value.HasMember("Breadth") && !value["Breadth"].IsNull())
    {
        if (!value["Breadth"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.Breadth` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_breadth = string(value["Breadth"].GetString());
        m_breadthHasBeenSet = true;
    }

    if (value.HasMember("Heat") && !value["Heat"].IsNull())
    {
        if (!value["Heat"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.Heat` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_heat = string(value["Heat"].GetString());
        m_heatHasBeenSet = true;
    }

    if (value.HasMember("Id") && !value["Id"].IsNull())
    {
        if (!value["Id"].IsUint64())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.Id` IsUint64=false incorrectly").SetRequestId(requestId));
        }
        m_id = value["Id"].GetUint64();
        m_idHasBeenSet = true;
    }

    if (value.HasMember("FileName") && !value["FileName"].IsNull())
    {
        if (!value["FileName"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.FileName` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_fileName = string(value["FileName"].GetString());
        m_fileNameHasBeenSet = true;
    }

    if (value.HasMember("CreateTime") && !value["CreateTime"].IsNull())
    {
        if (!value["CreateTime"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.CreateTime` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_createTime = string(value["CreateTime"].GetString());
        m_createTimeHasBeenSet = true;
    }

    if (value.HasMember("LatestScanTime") && !value["LatestScanTime"].IsNull())
    {
        if (!value["LatestScanTime"].IsString())
        {
            return CoreInternalOutcome(Error("response `MalwareInfo.LatestScanTime` IsString=false incorrectly").SetRequestId(requestId));
        }
        m_latestScanTime = string(value["LatestScanTime"].GetString());
        m_latestScanTimeHasBeenSet = true;
    }


    return CoreInternalOutcome(true);
}

void MalwareInfo::ToJsonObject(Value &value, Document::AllocatorType& allocator) const
{

    if (m_virusNameHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "VirusName";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_virusName.c_str(), allocator).Move(), allocator);
    }

    if (m_fileSizeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "FileSize";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, m_fileSize, allocator);
    }

    if (m_mD5HasBeenSet)
    {
        Value iKey(kStringType);
        string key = "MD5";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_mD5.c_str(), allocator).Move(), allocator);
    }

    if (m_filePathHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "FilePath";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_filePath.c_str(), allocator).Move(), allocator);
    }

    if (m_fileCreateTimeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "FileCreateTime";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_fileCreateTime.c_str(), allocator).Move(), allocator);
    }

    if (m_fileModifierTimeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "FileModifierTime";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_fileModifierTime.c_str(), allocator).Move(), allocator);
    }

    if (m_harmDescribeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "HarmDescribe";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_harmDescribe.c_str(), allocator).Move(), allocator);
    }

    if (m_suggestSchemeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "SuggestScheme";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_suggestScheme.c_str(), allocator).Move(), allocator);
    }

    if (m_serversNameHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "ServersName";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_serversName.c_str(), allocator).Move(), allocator);
    }

    if (m_hostIpHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "HostIp";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_hostIp.c_str(), allocator).Move(), allocator);
    }

    if (m_processNameHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "ProcessName";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_processName.c_str(), allocator).Move(), allocator);
    }

    if (m_processIDHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "ProcessID";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_processID.c_str(), allocator).Move(), allocator);
    }

    if (m_tagsHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "Tags";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(kArrayType).Move(), allocator);

        for (auto itr = m_tags.begin(); itr != m_tags.end(); ++itr)
        {
            value[key.c_str()].PushBack(Value().SetString((*itr).c_str(), allocator), allocator);
        }
    }

    if (m_breadthHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "Breadth";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_breadth.c_str(), allocator).Move(), allocator);
    }

    if (m_heatHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "Heat";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_heat.c_str(), allocator).Move(), allocator);
    }

    if (m_idHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "Id";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, m_id, allocator);
    }

    if (m_fileNameHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "FileName";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_fileName.c_str(), allocator).Move(), allocator);
    }

    if (m_createTimeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "CreateTime";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_createTime.c_str(), allocator).Move(), allocator);
    }

    if (m_latestScanTimeHasBeenSet)
    {
        Value iKey(kStringType);
        string key = "LatestScanTime";
        iKey.SetString(key.c_str(), allocator);
        value.AddMember(iKey, Value(m_latestScanTime.c_str(), allocator).Move(), allocator);
    }

}


string MalwareInfo::GetVirusName() const
{
    return m_virusName;
}

void MalwareInfo::SetVirusName(const string& _virusName)
{
    m_virusName = _virusName;
    m_virusNameHasBeenSet = true;
}

bool MalwareInfo::VirusNameHasBeenSet() const
{
    return m_virusNameHasBeenSet;
}

int64_t MalwareInfo::GetFileSize() const
{
    return m_fileSize;
}

void MalwareInfo::SetFileSize(const int64_t& _fileSize)
{
    m_fileSize = _fileSize;
    m_fileSizeHasBeenSet = true;
}

bool MalwareInfo::FileSizeHasBeenSet() const
{
    return m_fileSizeHasBeenSet;
}

string MalwareInfo::GetMD5() const
{
    return m_mD5;
}

void MalwareInfo::SetMD5(const string& _mD5)
{
    m_mD5 = _mD5;
    m_mD5HasBeenSet = true;
}

bool MalwareInfo::MD5HasBeenSet() const
{
    return m_mD5HasBeenSet;
}

string MalwareInfo::GetFilePath() const
{
    return m_filePath;
}

void MalwareInfo::SetFilePath(const string& _filePath)
{
    m_filePath = _filePath;
    m_filePathHasBeenSet = true;
}

bool MalwareInfo::FilePathHasBeenSet() const
{
    return m_filePathHasBeenSet;
}

string MalwareInfo::GetFileCreateTime() const
{
    return m_fileCreateTime;
}

void MalwareInfo::SetFileCreateTime(const string& _fileCreateTime)
{
    m_fileCreateTime = _fileCreateTime;
    m_fileCreateTimeHasBeenSet = true;
}

bool MalwareInfo::FileCreateTimeHasBeenSet() const
{
    return m_fileCreateTimeHasBeenSet;
}

string MalwareInfo::GetFileModifierTime() const
{
    return m_fileModifierTime;
}

void MalwareInfo::SetFileModifierTime(const string& _fileModifierTime)
{
    m_fileModifierTime = _fileModifierTime;
    m_fileModifierTimeHasBeenSet = true;
}

bool MalwareInfo::FileModifierTimeHasBeenSet() const
{
    return m_fileModifierTimeHasBeenSet;
}

string MalwareInfo::GetHarmDescribe() const
{
    return m_harmDescribe;
}

void MalwareInfo::SetHarmDescribe(const string& _harmDescribe)
{
    m_harmDescribe = _harmDescribe;
    m_harmDescribeHasBeenSet = true;
}

bool MalwareInfo::HarmDescribeHasBeenSet() const
{
    return m_harmDescribeHasBeenSet;
}

string MalwareInfo::GetSuggestScheme() const
{
    return m_suggestScheme;
}

void MalwareInfo::SetSuggestScheme(const string& _suggestScheme)
{
    m_suggestScheme = _suggestScheme;
    m_suggestSchemeHasBeenSet = true;
}

bool MalwareInfo::SuggestSchemeHasBeenSet() const
{
    return m_suggestSchemeHasBeenSet;
}

string MalwareInfo::GetServersName() const
{
    return m_serversName;
}

void MalwareInfo::SetServersName(const string& _serversName)
{
    m_serversName = _serversName;
    m_serversNameHasBeenSet = true;
}

bool MalwareInfo::ServersNameHasBeenSet() const
{
    return m_serversNameHasBeenSet;
}

string MalwareInfo::GetHostIp() const
{
    return m_hostIp;
}

void MalwareInfo::SetHostIp(const string& _hostIp)
{
    m_hostIp = _hostIp;
    m_hostIpHasBeenSet = true;
}

bool MalwareInfo::HostIpHasBeenSet() const
{
    return m_hostIpHasBeenSet;
}

string MalwareInfo::GetProcessName() const
{
    return m_processName;
}

void MalwareInfo::SetProcessName(const string& _processName)
{
    m_processName = _processName;
    m_processNameHasBeenSet = true;
}

bool MalwareInfo::ProcessNameHasBeenSet() const
{
    return m_processNameHasBeenSet;
}

string MalwareInfo::GetProcessID() const
{
    return m_processID;
}

void MalwareInfo::SetProcessID(const string& _processID)
{
    m_processID = _processID;
    m_processIDHasBeenSet = true;
}

bool MalwareInfo::ProcessIDHasBeenSet() const
{
    return m_processIDHasBeenSet;
}

vector<string> MalwareInfo::GetTags() const
{
    return m_tags;
}

void MalwareInfo::SetTags(const vector<string>& _tags)
{
    m_tags = _tags;
    m_tagsHasBeenSet = true;
}

bool MalwareInfo::TagsHasBeenSet() const
{
    return m_tagsHasBeenSet;
}

string MalwareInfo::GetBreadth() const
{
    return m_breadth;
}

void MalwareInfo::SetBreadth(const string& _breadth)
{
    m_breadth = _breadth;
    m_breadthHasBeenSet = true;
}

bool MalwareInfo::BreadthHasBeenSet() const
{
    return m_breadthHasBeenSet;
}

string MalwareInfo::GetHeat() const
{
    return m_heat;
}

void MalwareInfo::SetHeat(const string& _heat)
{
    m_heat = _heat;
    m_heatHasBeenSet = true;
}

bool MalwareInfo::HeatHasBeenSet() const
{
    return m_heatHasBeenSet;
}

uint64_t MalwareInfo::GetId() const
{
    return m_id;
}

void MalwareInfo::SetId(const uint64_t& _id)
{
    m_id = _id;
    m_idHasBeenSet = true;
}

bool MalwareInfo::IdHasBeenSet() const
{
    return m_idHasBeenSet;
}

string MalwareInfo::GetFileName() const
{
    return m_fileName;
}

void MalwareInfo::SetFileName(const string& _fileName)
{
    m_fileName = _fileName;
    m_fileNameHasBeenSet = true;
}

bool MalwareInfo::FileNameHasBeenSet() const
{
    return m_fileNameHasBeenSet;
}

string MalwareInfo::GetCreateTime() const
{
    return m_createTime;
}

void MalwareInfo::SetCreateTime(const string& _createTime)
{
    m_createTime = _createTime;
    m_createTimeHasBeenSet = true;
}

bool MalwareInfo::CreateTimeHasBeenSet() const
{
    return m_createTimeHasBeenSet;
}

string MalwareInfo::GetLatestScanTime() const
{
    return m_latestScanTime;
}

void MalwareInfo::SetLatestScanTime(const string& _latestScanTime)
{
    m_latestScanTime = _latestScanTime;
    m_latestScanTimeHasBeenSet = true;
}

bool MalwareInfo::LatestScanTimeHasBeenSet() const
{
    return m_latestScanTimeHasBeenSet;
}

